package com.cwd.arm.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yan on 21-12-22.
 */
public enum ProjectTypeEnum {

    EPC("EPC", "EPC"),
    DECOR_PROGRAM("DECOR_PROGRAM", "装饰工程"),
    CIVIL_PROGRAM("CIVIL_PROGRAM", "土建工程"),
    SCENERY_PROGRAM("SCENERY_PROGRAM", "景观工程"),
    LIGHT_PROGRAM("LIGHT_PROGRAM", "灯光工程"),
    DECOR_DESIGN("DECOR_DESIGN", "装饰设计"),
    PROJECT_OTHER("PROJECT_OTHER", "其他"),
    ;

    String code; // 状态编号
    String name; //状态名称

    ProjectTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(String code) {
        for (ProjectTypeEnum typeEnum : ProjectTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum.getName();
            }
        }
        return null;
    }

    public static String getCode(String name) {
        for (ProjectTypeEnum typeEnum : ProjectTypeEnum.values()) {
            if (typeEnum.getName().equals(name)) {
                return typeEnum.getCode();
            }
        }
        return null;
    }

    public static List<String> getNameList() {
        List<String> nameList = new ArrayList<>();
        for (ProjectTypeEnum typeEnum : ProjectTypeEnum.values()) {
            nameList.add(typeEnum.getName());
        }
        return nameList;
    }
}
